package com.ysstech.finance.thread;

import java.util.Date;
import java.util.concurrent.Callable;

import com.ysstech.common.util.DateUtil;
import com.ysstech.finance.entity.Balance;
import com.ysstech.finance.service.BalanceService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;

@Slf4j
public class BalanceThread implements Callable<T> {
    private Balance balance;
    private BalanceService balanceService;

    public BalanceThread(BalanceService balanceService, Balance balance) {
        this.balanceService = balanceService;
        this.balance = balance;
    }

    @Override
    public T call() throws Exception {
        log.info(DateUtil.dateToStrByFormat(new Date(), "yyyy-MM-dd HH:mm:ss:SSS") + balance.getAccountId());
        balanceService.produceBalance(balance);
        return null;
    }
}
